from wtforms_tornado import Form
from wtforms import StringField, TextAreaField
from wtforms.validators import DataRequired, Length, Regexp, AnyOf

MOBILE_EXP = "^1([38]\d|5[0-35-9]|7[3678])\d{8}$"


class SmsCodeForm(Form):
    mobile = StringField("手机号", validators=[DataRequired(message="请输入手机号码!"), Regexp(MOBILE_EXP,message="请输入正确的手机号码")])

class RegisterForm(Form):
    mobile = StringField("手机号", validators=[DataRequired(message="请输入手机号码!"), Regexp(MOBILE_EXP, message="请输入正确的手机号码")])
    code = StringField("验证码", validators=[DataRequired(message="请输入验证码!")])
    password = StringField("密码", validators=[DataRequired(message="请输入密码!")])

class LoginForm(Form):
    mobile = StringField("手机号", validators=[DataRequired(message="请输入手机号码!"), Regexp(MOBILE_EXP, message="请输入正确的手机号码")])
    password = StringField("密码", validators=[DataRequired(message="请输入密码!")])

class ProfileForm(Form):
    #nickname = StringField("昵称")
    gender = StringField("性别", )
    address = StringField("地址",)
    desc = TextAreaField("个人简介")